<%-- 
    Document   : management_product_info
    Created on : 2014/4/23, 下午 04:23:05
    Author     : Gjun
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <head>
        <meta name="viewport" content="width=device-width" />
		<title>產品維護</title>
		<link rel="stylesheet" href="style/management_style.css?v=2">
		<link rel="stylesheet" href="style/minippfix.css">
        <script src="/MyStruts2/scripts/jquery-1.11.0.min.js"></script>
       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../cloud-zoom/cloud-zoom.1.0.2.min.js"></script> 
<link type="text/css" href="../cloud-zoom/cloud-zoom.css" rel="stylesheet" media="screen" /> 
<script type="text/javascript" src="../thickbox/thickbox-compressed.js"></script> 
<link type="text/css" href="../thickbox/thickbox.css" rel="stylesheet" media="screen" /> 
<link type="text/css" href="/playdoll/css/Base.css" rel="stylesheet" media="screen" />
        <style type="text/css">
        .Header { text-align:right; font-weight:bold; }
        #ProductList td { padding:10px; }
        </style>
                 <script type="text/javascript">
            $(document).ready(function(){
                $("#SearchBtn").click(function(){                    
                    if($("#IDText").val().length>0)
                        window.location="/playdoll/backstage/product/productInfo?id="+$("#IDText").val();                    
                }); 
                 $("#changeUpdate").click(function(){                    
                    if($("#changeId").val().length>0)
                        window.location="/playdoll/backstage/product/productInfo?id="+$("#changeId").val();                    
                }); 
                
                if (${title.equals("新增產品")}){
                    $("#IDText").attr("value","${checkid+1}");
                  }
                 }
             );
              function init() {
           document.getElementById('flotLayer').style.visibility = 'visible';
          MoveLayer('flotLayer'); 
        }
        function MoveLayer(layerName) {
        var x = 50;
          var y = 50; 
        var _y = document.body.scrollTop + y;
        var diff =(_y - parseInt(document.getElementById('flotLayer').style.top))*.40;
        var rey=_y-diff;
 
        document.getElementById('flotLayer').style.top=rey;
        document.getElementById('flotLayer').style.right=x;
        setTimeout("MoveLayer('flotLayer');", 50); 
 
            } 
        </script>
	</head>
        <body onLoad="init()">
            <div id="flotLayer" style="position:absolute;width:80px;height:80px;z-index:20;visibility:visible;left: 150px;top:100px;">
                <!--<div id=flotLayer style="position:absolute;width:61px;height:59px;z-index:20;visibility:hidden;right: 10px;top:0px;">-->
                <div align="center" style="width:250px; height:400px;top:10px; border:solid 1px #cccccc">
               
                <h1>管理人員須知:</h1>
                <a href="backstage">．按這裡回到首頁．</a>
                <h3 align="center">請一次上傳四張圖片</h3>
                </br></br>
                <img align="center" src="/playdoll/images/7.jpg" style="width:100px; height:100px"/>
                <img align="center"src="/playdoll/images/8.jpg" style="width:100px; height:100px" /><br>
                <img align="center"src="/playdoll/images/9.jpg" style="width:100px; height:100px" />
                <img align="center"src="/playdoll/images/10.jpg" style="width:100px; height:100px"/>
               </div>
            </div>
               <div style="width:100px; height:0px;"></div> 
    
                <h1 align="center">${title}資料</h1>
               
                 <c:if test='${title.equals("新增產品")}'>                
                     <h1 align="center">現在產品總筆數${checkid}筆!</h1>
                 </c:if>
     <center>
        
                 <c:if test='${title.equals("修改產品")}'>               
                    <form action="updateproduct" method="post" enctype="multipart/form-data">
                      <h3 align="center">你想要改第
                      <input id="changeId" type="text" value="" />筆!
                        <input id="changeUpdate" type="button" value="更新產品資訊" /></h3>
                    </form>
                 </c:if>
                    
             
             
       
         <form action="${title.equals("新增產品")?"add":"update"}product" method="post" enctype="multipart/form-data">
           <table id="ProductList" border="0">	
		
        <tr>
            <td class="Header"><label for="IDText">產品編號：</label></td>
            <td><input id="IDText" name="id" type="text"  value="${productItem_Back["id"]}"  /></td>   
        </tr>
        <tr>
            <td class="Header"><label for="NameText">產品名稱：</label></td>
            <td><input id="NameText" name="name" type="text" value="${productItem_Back["name"]}" /></td>
        </tr>        
        <tr>
            <td class="Header"><label for="PriceText">單價：</label></td>
            <td><input id="PriceText" name="price" type="text" value="${productItem_Back["price"]}" /></td>
        </tr>
        <tr>
            <td class="Header"><label for="StockText">庫存量：</label></td>
            <td><input id="StockText" name="stock" type="text" value="${productItem_Back["stock"]}" /></td>
        </tr>
        <tr>
            <td class="Header"><label for="Sale" >上下架：</label></td>
            <td><input id="UnitText" name="sale" type="text" placeholder="1是上架 0是下架" value="${productItem_Back["sale"]}" /></td>
        </tr>
        <tr>
            <td class="Header"><label for="TypeId">產品種類編號：</label></td>
            <td><input id="TypeId" name="typeId" type="text" value="${productItem_Back["typeId"]}" /></td>
         </tr> 
         <tr>
            <td class="Header"><label for="Click_count">點閱次數：</label></td>
            <td><input id="StockText" name="click_count" type="text" value="${productItem_Back["click_count"]}" /></td>
        </tr>		
        <tr>
            <td class="Header"><label for="Description">產品敘述：</label></td>

            <td><textarea name="description" id="StockText" style="width: 300px; height: 150px;" >${productItem_Back["description"]}</textarea></td>

        </tr>
        <tr>
            <td class="Header"><label for="pic">產品圖片：</label></td>
            <td><input id="Img" name="pic" type="file" value="123" /></td>
        </tr>
	 <tr>
            <td class="Header"><label for="pic_1">產品圖片_1：</label></td>
            <td><input id="Img" name="pic_1" type="file" value="" /></td>
        </tr>
	<tr>
            <td class="Header"><label for="pic_2">產品圖片_2：</label></td>
            <td><input id="Img" name="pic_2" type="file" value="" /></td>
        </tr>
        <tr>
            <td class="Header"><label for="pic_3">產品圖片_3：</label></td>
            <td><input id="Img" name="pic_3" type="file" value="" />
          </td>
        </tr>
	 <tr>
            <td class="Header">&nbsp</td>
            <td><input type="submit" value="${title}" />&nbsp;&nbsp;
                <input type="reset" value="重新填寫" /></td>
        </tr>
         
      
         
        <!-- 
       <td class="Header"></br></br></br><label for="StockText">換一筆產品編號：</label></td>
            <td></br></br></br><input id="IDText" type="text" value="" />&nbsp;&nbsp;
				<input id="SearchBtn" type="submit" value="顯示" /></td>

 		
        </tr> -->
           </table>
            <%--
                if (request.getAttribute("title")=="修改產品")
                {   System.out.println("FUCK");    }
                   --%>
            <c:if test='${title.equals("修改產品")}' >                     
             <div >          
                  <table>
                     <tr>
                    	<td><img align="center" src="/playdoll/WebTool/GetProductPic.jsp?pid=${productItem_Back['id']}" style="width:160px;height:160px;"/></td>
	
                    	<td><img align="center" src="/playdoll/WebTool/GetProductPic_4pic.jsp?pid=${productItem_Back['id']}&pp=1" style="width:160px;height:160px;"/></td>
	
                	<td><img align="center" src="/playdoll/WebTool/GetProductPic_4pic.jsp?pid=${productItem_Back['id']}&pp=2" style="width:160px;height:160px;"/></td>
	
                         <td><img align="center" src="/playdoll/WebTool/GetProductPic_4pic.jsp?pid=${productItem_Back['id']}&pp=3" style="width:160px;height:160px;"/></td>
                      </tr>
                  </table>
             </div>
            </c:if>                  
          ${title}        
    </form>
	</center>
</body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    
</body>
</html>

